package com.tbit.uqbike.client.constant;

/**
 * redis key常量
 *
 * @Author:BUGTian
 * @DATE: 2022/9/2
 */
public class RedisKeyConstant {
    /**
     * 客户端登录token
     */
    public static final String CLIENT_LOGIN_USER_KEY = "USER";
    /**
     * 登录锁定时间key format
     */
    private static final String LOGIN_LOCK_TIME_FORMAT = "errorCode.%s.%s.lockTime";
    /**
     * 登录错误次数计数key format
     */
    private static final String LOGIN_LOCK_COUNT_FORMAT = "errorCode.%s.%s";
    /**
     * 运维端低电提醒断电key format
     */
    private static final String MACHINE_BORROW_MANAGER = "MACHINE_BORROW_MANAGER%s";

    /**
     * 获取锁定时间Key
     *
     * @param phone    手机号
     * @param clientIP ip
     * @return
     */
    public static String getLockTimeKey(String phone, String clientIP) {
        return String.format(LOGIN_LOCK_TIME_FORMAT, phone, clientIP);
    }

    /**
     * 获取错误次数计数key
     *
     * @param phone
     * @param clientIP
     * @return
     */
    public static String getLockCountKey(String phone, String clientIP) {
        return String.format(LOGIN_LOCK_COUNT_FORMAT, phone, clientIP);
    }

    /**
     * 获取运维端低电提醒换电key
     *
     * @param machineNo
     * @return
     */
    public static String getMachineBorrowKey(String machineNo) {
        return String.format(MACHINE_BORROW_MANAGER, machineNo);
    }
}
